//
// Created by Administrator on 2019/12/12 012.
//

#include <map>
#include <cstring>
#include <iostream>
using namespace std;

void map1(){
    std::map<int, string> mymap;
    mymap.insert(std::pair<int, string>(0, "hxx"));
    //数组方式可以覆盖
    mymap[1] = "ytf";
    mymap.insert(map<int, string>::value_type(2, "fff"));
    const auto &it = mymap.find(1);
    if(it != mymap.end())
    {
        cout<<it->second<<endl;
        cout<<mymap.size()<<endl;
    }else
    {
        cout<<"not found"<<endl;
    }
    mymap.erase(it);
    for(auto t = mymap.begin(); t != mymap.end(); )
    {
        cout<<t->first<<":"<<t->second<<endl;
        ++t;
    }
}